package struct.advanced.heap;

import java.util.Random;

/**
 * @author MAX
 * @version 1.0
 * @description TODO
 * @date 2022/1/22 16:44
 */
public class MaxHeapTest {

    public static void main(String[] args) {
        int n = 1000000;
        MaxHeap<Integer> maxHeap = new MaxHeap<>();
        Random random = new Random();

        long startTime = System.nanoTime();
        for (int i = 0; i < n; i++) {
            maxHeap.add(random.nextInt(Integer.MAX_VALUE));
        }

        for (int j = 0; j < n; j++) {
            maxHeap.extractMax();
        }

        long endTime = System.nanoTime();
        double time = (endTime - startTime) / 1000000000.0;
        System.out.println("bst cost time: " + time  + "s");
    }
}
